"""
截图操作
"""
import time

from selenium import webdriver
from selenium.webdriver.common.by import By

from utils.get_filepath import get_screen_shot_path

driver = webdriver.Chrome()
driver.get("https://news.baidu.com/")
driver.maximize_window()
element = driver.find_element(By.XPATH, '//*[@id="city_name"]')
driver.execute_script('arguments[0].scrollIntoViewIfNeeded(false);', element)
driver.save_screenshot(get_screen_shot_path())

time.sleep(3)

driver.close()
